package com.jiazhong.构造方法;

public class Demo02 {
    public static void main(String[] args) {
        Person2 person2=new Person2("张三",23);
        Person2 person1=new Person2("李四");
        System.out.println(person2.getName()+" "+person2.getAge());
        System.out.println(person1.getName());
        Dog dog=new Dog();
        System.out.println();
    }
}
class Person2{
    private String name;
    private int age;

    public Person2(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public Person2(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public int getAge() {
        return age;
    }
}
class Dog{
    public Dog(String name){

    }

    public Dog() {
    }
}
